﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace SampleVariableGridView.Controls
{
    public interface IResizable
    {
        int ColumnSpan { get; set; }
        int RowSpan { get; set; }
    }

    public class VariableGridView : GridView
    {
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            var model = item as IResizable;
            if(model != null)
            {
                element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty, model.ColumnSpan);
                element.SetValue(VariableSizedWrapGrid.RowSpanProperty, model.RowSpan);
            }

            base.PrepareContainerForItemOverride(element, item);
        }
    }
}
